package com.campus.service.impl;

import com.campus.entity.TManagerActivity;
import com.campus.mapper.ActivityMapper;
import com.campus.service.IActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ActivityServiceImpl implements IActivityService {

    @Autowired
    private ActivityMapper activityMapper;

    @Override
    public int creatActivity(Integer id, String name, String category, String title, String creator, String abstractInfo, String detailedDesc, Integer status, String picUrls) {
        TManagerActivity tManagerActivity = new TManagerActivity();

        tManagerActivity.setId(id);
        tManagerActivity.setName(name);
        tManagerActivity.setCategory(category);
        tManagerActivity.setTitle(title);
        tManagerActivity.setCreator(creator);
        tManagerActivity.setAbstractInfo(abstractInfo);
        tManagerActivity.setDetailedDesc(detailedDesc);
        tManagerActivity.setStatus(status);
        tManagerActivity.setPicUrls(picUrls);

        return activityMapper.createActivity(tManagerActivity);
    }

    @Override
    public int updateActivity(Integer id, String name, String category, String title, String creator, String abstractInfo, String detailedDesc, Integer status, String picUrls) {
        return activityMapper.updateActivity(id, name, category, title, creator, abstractInfo, detailedDesc, status, picUrls);
    }

    @Override
    public List<Object> queryActivity(String status, String name) {
        return activityMapper.queryActivity(status, name);
    }
}
